package com.codeying.servlet.car;
import com.codeying.entity.*;
import com.codeying.servlet.AbsServlet;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.List;
import com.codeying.utils.*;
import com.codeying.utils.component.*;
/**
 * 编辑页面汽车
 */
@WebServlet("/car/edit")
public class EditCarServlet  extends AbsServlet {

    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
        LoginUser loginUser = MyUtils.getUser(req);
        req.setCharacterEncoding("utf-8");
        String id = req.getParameter("id");
        Car car = carService.getBy("id",id);

        if(car==null){
            car = new Car();
            //TODO 可接受其他参数 ：req.getParameter("XX")
        }
        req.setAttribute("item",car );
        req.getRequestDispatcher("/pages/car-edit.jsp").forward(req,resp);

    }
}

